<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>微信用户信息</title>
<script src="${ctx}/static/selectWin/appSelector.js?version=${applicationScope.jsVersion }" type="text/javascript"></script>
<script src="${ctx}/static/selectWin/groupsSelector.js?version=${applicationScope.jsVersion }" type="text/javascript"></script>
<script type="text/javascript">
	var $grid;
	$(function() {
		$grid = $("#grid").datagrid($.extend(datagridOption, {
			url : "${ctx}/wx/eventRecord/dataGrid",
			columns : [ [ {
				field : 'ck',
				checkbox : true
			}, {
				field : 'app.appName',
				title : '所属公共账号',
				sortable : true,
				formatter : function(val, row, index) {
					return row.app ? row.app.appName : "";
				}
			}, {
				field : 'toUserName',
				title : '微信服务号',
				sortable : true
			}, {
				field : 'fromUserName',
				title : '发送方帐号',
				sortable : true
			}, {
				field : 'msgCreateTime',
				title : '消息创建时间',
				sortable : true
			}, {
				field : 'msgType',
				title : '消息类型',
				sortable : true
			}, {
				field : 'event',
				title : '事件类型',
				sortable : true
			}, {
				field : 'eventKey',
				title : '事件KEY值',
				sortable : true,
				formatter : function(val) {
					if (val != null && val.length > 25) {
						return val.substr(0, 25) + "...";
					} else {
						return val;
					}
				}
			}, {
				field : 'ticket',
				title : '二维码的ticket',
				sortable : true
			}, {
				field : 'latitude',
				title : '地理位置纬度',
				sortable : true
			}, {
				field : 'longitude',
				title : '地理位置经度',
				sortable : true
			}, {
				field : 'precision',
				title : '地理位置精度',
				sortable : true
			} ] ]
		}));

		$("#grid").datagrid('enableFilter', [ {
			field : 'msgCreateTime',
			noFliter : true
		} ]);
		$("#delete").click(function() {
			multiDeleteDataGrid($grid, "${ctx}/wx/wxUser/multiDelete");
		});
		$("#search").click(function() {
			$grid.datagrid('load', $("#tt").form("getData"));
		});
		$("#excelExport").click(function() {
			var url = "${ctx}/wx/eventRecord/excelExport?" + $.param($grid.datagrid('options').queryParams);
			if ($grid.datagrid("options").filterRules) {
				url += "&filterRules=" + JSON.stringify($grid.datagrid("options").filterRules);
			}
			window.parent.location.href = url;
		});
	});
</script>
</head>

<body>
	<div data-options="region:'center',fit:true,border:false">
		<table id="grid">
		</table>
	</div>
	<div id="tt" class="easyui-toolbar">
		<span>消息创建时间从：</span> <input name="search_GT-T_msgCreateTime" class="easyui-my97" datefmt="yyyy-MM-dd 00:00:00"
			style="margin: 2px; width: 150px;" /> <span>到：</span> <input name="search_LT-T_msgCreateTime" class="easyui-my97"
			datefmt="yyyy-MM-dd 23:59:59" style="margin: 2px; width: 150px;" /><a id="search" class="easyui-linkbutton"
			data-options="plain: true, iconCls: 'icon-hamburg-zoom'">查询</a>
		<shiro:hasPermission name="wxUser:export">
			<a id="excelExport" class="easyui-linkbutton" data-options="plain: true, iconCls: 'icon-standard-page-excel'">Excel导出</a>
		</shiro:hasPermission>
	</div>
</body>
</html>
